package com.topvision.controller.hes;

import com.topvision.controller.AbstractController;
import com.topvision.model.hes.Videostreamdetail;
import com.topvision.service.hes.VideostreamdetailService;
import com.topvision.util.PageUtils;
import com.topvision.util.Query;
import com.topvision.util.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 会议详情
 *
 * @author jack
 * @email 791127866@qq.com
 * @date 2017-09-29 17:27:24
 */
@RestController
@RequestMapping("glass/videostreamdetail")
public class VideostreamdetailController extends AbstractController {
    @Autowired
    private VideostreamdetailService videostreamdetailService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("glass/videostreamdetail:list")
    public R list(@RequestParam Map<String, Object> params) {
        //查询列表数据
        Query query = new Query(params);

        List<Videostreamdetail> videostreamdetailList = videostreamdetailService.queryList(query);
        int total = videostreamdetailService.queryTotal(query);

        PageUtils pageUtil = new PageUtils(videostreamdetailList, total, query.getLimit(), query.getPage());

        return R.success().put("page", pageUtil);
    }

    @RequestMapping("/findListByParam")
    @RequiresPermissions("glass/videostreamdetail:list")
    public R findListByParam(@RequestParam Map<String, Object> params) {

        List<Videostreamdetail> videostreamdetailList = videostreamdetailService.queryByParam(params);

        return R.success().put("videostreamdetailList", videostreamdetailList);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("glass/videostreamdetail:info")
    public R info(@PathVariable("id") Integer id) {
        Videostreamdetail videostreamdetail = videostreamdetailService.queryObject(id);
        return R.success().put("videostreamdetail", videostreamdetail);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("glass/videostreamdetail:save")
    public R save(@RequestBody Videostreamdetail videostreamdetail) {
        videostreamdetailService.save(videostreamdetail);
        return R.success();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("glass/videostreamdetail:update")
    public R update(@RequestBody Videostreamdetail videostreamdetail) {
        videostreamdetailService.update(videostreamdetail);
        return R.success();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("glass/videostreamdetail:delete")
    public R delete(@RequestBody Integer[] ids) {
        videostreamdetailService.deleteBatch(ids);
        return R.success();
    }

}
